package com.liuche.controller;

import cn.hutool.json.JSONObject;
import com.liuche.service.ArthasService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author：liuche
 * @Date：2024年08月25日 09:40
 * @Description：
 */
@RestController
@RequestMapping("/arthas")
public class ArthasController {
    @Resource
    private ArthasService arthasService;

    @GetMapping("/hello")
    public String hello() {
        return "hello arthas!";
    }


    /**
     * 测试CPU沾满
     * @return 结果
     */
    @GetMapping("/cpu")
    public String cpuFull() {
        arthasService.cpuFull();
        return "cpuFull";
    }

    @GetMapping("/dead-lock")
    public String deadLock() {
        arthasService.testDeadLock();
        return "test dead lock";
    }

    @GetMapping("/queryUser")
    public JSONObject queryUser() throws Exception {
        return arthasService.queryUser(1);
    }
}
